package com.ggh.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ggh.dao.RoomWinRecordMapper;
import com.ggh.entity.Airlines;
import com.ggh.entity.RoomBeanP;
import com.ggh.entity.RoomWinRecord;
import com.ggh.service.AirlinesService;
import com.ggh.service.RoomWinRecordService;
import com.ggh.vo.Body;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;
import java.util.List;

/**
 * @author ： jsq
 * @date ：2019/10/13 22:24
 * @description : 没局房间内的输赢统计
 * @path : com.ggh.service.impl.RoomRecordServiceImpl
 * @modifiedBy ：
 */
@Service
public class RoomWinRecordServiceImpl extends ServiceImpl<RoomWinRecordMapper, RoomWinRecord> implements RoomWinRecordService {
    /**
    * @description :添加记录
    * @return: boolean
    * @date : 2019/10/14 15:15
    * @author : jj
    * @throws
    */
    @Override
    @Transactional(rollbackFor = Exception.class)
    public Body add(RoomBeanP  room){
        RoomWinRecord roomWinRecord=new RoomWinRecord();
            roomWinRecord.setRid(Integer.valueOf(room.getRoomno()));
            roomWinRecord.setChuWin(room.getChuWin());
            roomWinRecord.setTianWin(room.getTianWin());
            roomWinRecord.setMoWin(room.getMoWin());
            roomWinRecord.setGameType(room.getGame_type());
            roomWinRecord.setCreatyTime(new Date());
        int insert = baseMapper.insert(roomWinRecord);
        return Body.newInstance();
    }

    /**
     * 查询记录
     * @param tiao
     * @return
     */
    @Override
    public List<RoomWinRecord> roomWinRecordList(int roomid,int tiao){
        List<RoomWinRecord> roomWinRecords = baseMapper.roomWinRecordList(roomid,tiao);
        return roomWinRecords==null?null:roomWinRecords;
    }

    @Override
    public List<RoomWinRecord> aList(int tiao){
        List<RoomWinRecord> roomWinRecords = baseMapper.aList(tiao);
        return roomWinRecords==null?null:roomWinRecords;
    }
}
